package com.lgy.ms.service.service.base;

import com.lgy.ms.core.bean.RequestParams;
import com.lgy.ms.core.bean.SessionInfo;

/**
 * @author Gylin
 * 请求参数线程副本
 */
public class AppRequestParam {
    private static ThreadLocal<RequestParams> localParam = new ThreadLocal<>();
    private static ThreadLocal<SessionInfo> localSessionInfo = new ThreadLocal<>();

    public static void set(RequestParams requestParams) {
        localParam.set(requestParams);
    }

    public static RequestParams get() {
        return localParam.get();
    }

    public static void setSessionInfo(SessionInfo sessionInfo) {
        localSessionInfo.set(sessionInfo);
    }

    public static SessionInfo getSessionInfo() {
        return localSessionInfo.get();
    }

    public static void remove() {
        localParam.remove();
        localSessionInfo.remove();
    }
}
